# -*- coding:utf-8 -*-
import copy
lists = [66.25, 333, 333, 1, 1234.5]
# count
print(lists.count(333), lists.count(1)) # (2, 1)

# 新增
# insert
lists.insert(0, 'a')
lists.insert(999, 'b') # 没有报错
lists.insert(-1,'c')
print(lists)

# append
lists.append('d')
print(lists)

# 删除
# pop
print(lists.pop(),lists)
# remove
print(lists.remove('b'), lists)
# del
del  lists[0]
print(lists)
# clear
# lists.clear()


# 修改
lists[0] = 'new first'
print(lists)

# 查找
# index
print(lists.index(333))

# 排序
# reverse
lists.reverse()
print(lists)

# sort
lists2 = ['a', 'b', 'c', 'a']
lists2.sort()
print(lists2)


# 浅复制
lists3 = [1,2,3,['a','b','c']];
lists4 = lists3.copy()
lists3[0] = 11
print(lists3,lists4) # [11, 2, 3, ['a', 'b', 'c']] [1, 2, 3, ['a', 'b', 'c']]
lists4[3][0] = 'aa'
print(lists3, lists4) # [11, 2, 3, ['aa', 'b', 'c']] [1, 2, 3, ['aa', 'b', 'c']]

lists5 = copy.deepcopy(lists3)
lists5[3][0] = 'aaa'
print(lists3,lists5) # [11, 2, 3, ['aa', 'b', 'c']] [11, 2, 3, ['aaa', 'b', 'c']]






